package br.ucb.cesbdao.janelas;

import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.sql.SQLException;
import java.util.regex.PatternSyntaxException;

import javax.swing.ListSelectionModel;
import javax.swing.RowFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;

import org.apache.log4j.Logger;

import br.ucb.cesbdao.enuns.EnumFormatos;
import br.ucb.cesbdao.enuns.EnumLabelAndBotao;
import br.ucb.cesbdao.enuns.EnumMensagens;
import br.ucb.cesbdao.enuns.EnumResources;
import br.ucb.cesbdao.enuns.EnumTipoTrabalhador;
import br.ucb.cesbdao.model.AtendidoModel;
import br.ucb.cesbdao.model.PessoaModel;
import br.ucb.cesbdao.model.impl.AtendidoModelImpl;
import br.ucb.cesbdao.model.impl.PessoaModelImpl;
import br.ucb.cesbdao.modeloTabelas.ModeloTabelaPaciente;
import br.ucb.cesbdao.servicos.Servicos;
import br.ucb.cesbdao.visao.Visao;


@SuppressWarnings("serial")
public class JanelaListaPaciente extends javax.swing.JFrame implements KeyListener{

	private ModeloTabelaPaciente modeloTabelaPaciente = new ModeloTabelaPaciente();
	private Boolean afi,apoio;
	static Logger logger = Servicos.carregaLog(JanelaListaPaciente.class);

	public Boolean getAfi() {
		return afi;
	}

	public void setAfi(Boolean afi) {
		this.afi = afi;
	}

	public Boolean getApoio() {
		return apoio;
	}

	public void setApoio(Boolean apoio) {
		this.apoio = apoio;
	}

	public JanelaListaPaciente() throws SQLException, ClassNotFoundException {
		AtendidoModel model = new AtendidoModelImpl();
		initComponents();
		setResizable(false);
		modeloTabelaPaciente.setPacientes(model.consultaPaciente());
		tabelaPaciente.getTableHeader().setReorderingAllowed(false);
		tabelaPaciente.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		tabelaPaciente.setAutoCreateRowSorter(true);
		
		Toolkit kit = Toolkit.getDefaultToolkit();
		Image iconeBarra = kit.getImage(EnumResources.ICONE_PACIENTE.getCaminho());
		setIconImage(iconeBarra);

		this.setTitle(EnumLabelAndBotao.ATENDIDOS.getTexto());


	}

	private void initComponents() {

		bg_filtrarPorPaciente = new javax.swing.ButtonGroup();
		painelListarPaciente = new javax.swing.JPanel();
		painelFiltroPaciente = new javax.swing.JPanel();
		painelFiltrarPor = new javax.swing.JPanel();
		rb_filtrarPorNome = new javax.swing.JRadioButton();
		painelCamadasFiltrarPor = new javax.swing.JLayeredPane();
		txt_nomePaciente = new javax.swing.JTextField();
		painelResultadosPaciente = new javax.swing.JPanel();
		jScrollPane1 = new javax.swing.JScrollPane();
		tabelaPaciente = new javax.swing.JTable();
		btn_alterarPaciente = new javax.swing.JButton();
		btn_excluirPaciente = new javax.swing.JButton();
		btn_cancelarPaciente = new javax.swing.JButton();
		jcAbilitarAFI = new javax.swing.JCheckBox();
		jcAbilitarApoio = new javax.swing.JCheckBox();

		bg_filtrarPorPaciente.add(rb_filtrarPorNome);

		setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
		setBounds(new java.awt.Rectangle(300, 25, 0, 0));

		painelFiltroPaciente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, EnumLabelAndBotao.FILTRO.getTexto(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font(EnumFormatos.FONTE_TAHOMA.getFormato(), 1, 12))); // NOI18N

		

		painelFiltrarPor.setBorder(javax.swing.BorderFactory.createTitledBorder(null, EnumLabelAndBotao.FILTRAR_POR.getTexto(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font(EnumFormatos.FONTE_TAHOMA.getFormato(), 1, 11))); // NOI18N

		rb_filtrarPorNome.setSelected(true);
		rb_filtrarPorNome.setText(EnumLabelAndBotao.NOME.getTexto());

		javax.swing.GroupLayout painelFiltrarPorLayout = new javax.swing.GroupLayout(painelFiltrarPor);
		painelFiltrarPor.setLayout(painelFiltrarPorLayout);
		painelFiltrarPorLayout.setHorizontalGroup(
				painelFiltrarPorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(painelFiltrarPorLayout.createSequentialGroup()
						.addGap(18, 18, 18)
						.addComponent(rb_filtrarPorNome)
						.addContainerGap(34, Short.MAX_VALUE))
		);
		painelFiltrarPorLayout.setVerticalGroup(
				painelFiltrarPorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(painelFiltrarPorLayout.createSequentialGroup()
						.addContainerGap()
						.addComponent(rb_filtrarPorNome)
						.addContainerGap(16, Short.MAX_VALUE))
		);

		txt_nomePaciente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, EnumLabelAndBotao.NOME.getTexto(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font(EnumFormatos.FONTE_TAHOMA.getFormato(), 1, 11))); // NOI18N
		txt_nomePaciente.setBounds(10, 0, 260, 70);
		txt_nomePaciente.addKeyListener(this);
		
		painelCamadasFiltrarPor.add(txt_nomePaciente, javax.swing.JLayeredPane.DEFAULT_LAYER);


		jcAbilitarAFI.setText(EnumLabelAndBotao.MOSTRAR_AFI.getTexto());
		jcAbilitarAFI.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				selectPesquisa();
			}
		});

		jcAbilitarApoio.setText(EnumLabelAndBotao.MOSTRAR_APOIO.getTexto());
		jcAbilitarApoio.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				selectPesquisa();
			}
		});

		javax.swing.GroupLayout painelFiltroPacienteLayout = new javax.swing.GroupLayout(painelFiltroPaciente);
        painelFiltroPaciente.setLayout(painelFiltroPacienteLayout);
        painelFiltroPacienteLayout.setHorizontalGroup(
            painelFiltroPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelFiltroPacienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelFiltroPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jcAbilitarApoio)
                    .addComponent(jcAbilitarAFI)
                    .addGroup(painelFiltroPacienteLayout.createSequentialGroup()
                        .addComponent(painelFiltrarPor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(3, 3, 3)
                        .addComponent(painelCamadasFiltrarPor, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(179, 179, 179))
        );
        painelFiltroPacienteLayout.setVerticalGroup(
            painelFiltroPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelFiltroPacienteLayout.createSequentialGroup()
                .addGroup(painelFiltroPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(painelFiltrarPor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(painelFiltroPacienteLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(painelCamadasFiltrarPor, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jcAbilitarAFI)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
                .addComponent(jcAbilitarApoio))
        );

		painelResultadosPaciente.setBorder(javax.swing.BorderFactory.createTitledBorder(null, EnumLabelAndBotao.RESULTADOS.getTexto(), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font(EnumFormatos.FONTE_TAHOMA.getFormato(), 1, 12))); // NOI18N

		tabelaPaciente.setModel(modeloTabelaPaciente);

		jScrollPane1.setViewportView(tabelaPaciente);

		btn_alterarPaciente.setIcon(new javax.swing.ImageIcon(getClass().getResource(EnumResources.ICONE_MODIFICAR.getCaminho())));
		btn_alterarPaciente.setText(EnumLabelAndBotao.ALTERAR.getTexto());
		btn_alterarPaciente.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					btn_alterarPacienteActionPerformed(evt);
				} catch (SQLException e) {
					logger.error(e.getMessage());
					e.printStackTrace();
				} catch (ClassNotFoundException e) {
					logger.error(e.getMessage());
					e.printStackTrace();
				}
			}
		});

		btn_excluirPaciente.setIcon(new javax.swing.ImageIcon(getClass().getResource(EnumResources.ICONE_LIXEIRA.getCaminho())));
		btn_excluirPaciente.setText(EnumLabelAndBotao.EXCLUIR.getTexto());
		btn_excluirPaciente.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				try {
					btn_excluirPacienteActionPerformed(evt);
				} catch (NumberFormatException e) {
					logger.error(e.getMessage());
					e.printStackTrace();
				} catch (SQLException e) {
					logger.error(e.getMessage());
					e.printStackTrace();
				} catch (ClassNotFoundException e) {
					logger.error(e.getMessage());
					e.printStackTrace();
				}
			}
		});

		btn_cancelarPaciente.setIcon(new javax.swing.ImageIcon(getClass().getResource(EnumResources.ICONE_CANCELAR.getCaminho())));
		btn_cancelarPaciente.setText(EnumLabelAndBotao.CANCELAR.getTexto());
		btn_cancelarPaciente.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btn_cancelarPacienteActionPerformed(evt);
			}
		});

		javax.swing.GroupLayout painelResultadosPacienteLayout = new javax.swing.GroupLayout(painelResultadosPaciente);
		painelResultadosPaciente.setLayout(painelResultadosPacienteLayout);
		painelResultadosPacienteLayout.setHorizontalGroup(
				painelResultadosPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(painelResultadosPacienteLayout.createSequentialGroup()
						.addGroup(painelResultadosPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
								.addGroup(painelResultadosPacienteLayout.createSequentialGroup()
										.addGap(115, 115, 115)
										.addComponent(btn_alterarPaciente)
										.addGap(18, 18, 18)
										.addComponent(btn_excluirPaciente)
										.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(btn_cancelarPaciente))
										.addGroup(painelResultadosPacienteLayout.createSequentialGroup()
												.addContainerGap()
												.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 555, Short.MAX_VALUE)))
												.addContainerGap())
		);
		painelResultadosPacienteLayout.setVerticalGroup(
				painelResultadosPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelResultadosPacienteLayout.createSequentialGroup()
						.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)
						.addGap(18, 18, 18)
						.addGroup(painelResultadosPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
								.addComponent(btn_alterarPaciente)
								.addComponent(btn_excluirPaciente)
								.addComponent(btn_cancelarPaciente))
								.addContainerGap())
		);

		javax.swing.GroupLayout painelListarPacienteLayout = new javax.swing.GroupLayout(painelListarPaciente);
		painelListarPaciente.setLayout(painelListarPacienteLayout);
		painelListarPacienteLayout.setHorizontalGroup(
				painelListarPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, painelListarPacienteLayout.createSequentialGroup()
						.addContainerGap()
						.addGroup(painelListarPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
								.addGroup(painelListarPacienteLayout.createSequentialGroup()
										.addComponent(painelResultadosPaciente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
										.addGap(2, 2, 2))
										.addComponent(painelFiltroPaciente, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
										.addContainerGap())
		);
		painelListarPacienteLayout.setVerticalGroup(
				painelListarPacienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(painelListarPacienteLayout.createSequentialGroup()
						.addComponent(painelFiltroPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
						.addComponent(painelResultadosPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(
				layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(layout.createSequentialGroup()
						.addContainerGap()
						.addComponent(painelListarPaciente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
						.addContainerGap())
		);
		layout.setVerticalGroup(
				layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(layout.createSequentialGroup()
						.addContainerGap()
						.addComponent(painelListarPaciente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
						.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);

		pack();
	}

	private void btn_alterarPacienteActionPerformed(java.awt.event.ActionEvent evt) throws SQLException, ClassNotFoundException {
		PessoaModel model = new PessoaModelImpl();
		if(tabelaPaciente.getSelectedRow() == -1){
			Visao.showMessageWarning(EnumMensagens.MSG_ALERTA_ATENDIDO_N_SELECIONADO.getMensagem(), "Aviso do sistema");
			return;
		}

		if(modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getStatus() == 'I'){
			if(Visao.showYesNo(EnumMensagens.MSG_Q_CONFIRMACAO_ATIVAR_ATENDIDO.getMensagem(), "Aviso do sistema")){
				if(model.alteraStatusPessoa('A',modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getId()) != 0)
					Visao.showMessageWarning(EnumMensagens.MSG_CONFIRMACAO_ATIVAR_ATENDIDO.getMensagem(), "Aviso do sistema");
				else{
					Visao.showMessageWarning(EnumMensagens.MSG_ALERTA_ATIVAR_ATENDIDO.getMensagem(), "Aviso do sistema");
					return;
				}
			}
			else{
				Visao.showMessageWarning(EnumMensagens.MSG_ERRO_ATIVAR_ATENDIDO.getMensagem(), "Aviso do sistema");
				return;
			}
		}

		Janela.setTxt_codPaciente(""+modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getId());
		Janela.setTxt_nomePaciente(modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getNome());
		Janela.setRb_sexoPaciente(""+modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getSexo());
		Janela.setAmbienteAlteracaoPaciente();
		this.setVisible(false);
	}

	private void btn_excluirPacienteActionPerformed(java.awt.event.ActionEvent evt) throws NumberFormatException, SQLException, ClassNotFoundException {
		PessoaModel model = new PessoaModelImpl();
		if(tabelaPaciente.getSelectedRow() == -1){
			Visao.showMessageWarning(EnumMensagens.MSG_ALERTA_ATENDIDO_N_SELECIONADO.getMensagem(), "Aviso do sistema");
			return;
		}
		model.desativaPessoa(modeloTabelaPaciente.getPessoaAt(tabelaPaciente.getSelectedRow()).getId());
		setVisible(false);
	}

	@SuppressWarnings("unused")
	private void btn_pesquisarPacienteActionPerformed(java.awt.event.ActionEvent evt) {
		String busca = null;
		final TableRowSorter<ModeloTabelaPaciente> sorter = new TableRowSorter<ModeloTabelaPaciente>(modeloTabelaPaciente);
		busca = txt_nomePaciente.getText();
		tabelaPaciente.setRowSorter(sorter);
		if (busca.length() == 0 || busca.equals("  /  /    "))
			sorter.setRowFilter(null);
		else{
			try{
				sorter.setRowFilter(RowFilter.regexFilter("(?i)"+busca, 1, 2));
			}catch (PatternSyntaxException ex) {
				logger.error(ex.getMessage());
				Visao.showMessageWarning(EnumMensagens.MSG_ALERTA_FILTRAR.getMensagem(), "Aviso do Sistema");
			}
		}
	}
	private void selectPesquisa(){
		PessoaModel model = new PessoaModelImpl();
		AtendidoModel modelAtendido = new AtendidoModelImpl();
		modeloTabelaPaciente = new ModeloTabelaPaciente();
		tabelaPaciente.setModel(new DefaultTableModel());
		if(jcAbilitarApoio.isSelected()){
			if(jcAbilitarAFI.isSelected()){
				modeloTabelaPaciente.setPacientes(model.listaPessoa());
				tabelaPaciente.setModel(modeloTabelaPaciente);
			}else{
				modeloTabelaPaciente.setPacientes(model.consultaPessoaByTipo(EnumTipoTrabalhador.AFI.getTipo()));
				tabelaPaciente.setModel(modeloTabelaPaciente);
			}
		}else if(jcAbilitarAFI.isSelected()){
			modeloTabelaPaciente.setPacientes(model.consultaPessoaByTipo(EnumTipoTrabalhador.APOIO.getTipo()));
			tabelaPaciente.setModel(modeloTabelaPaciente);
		}
		else{
			modeloTabelaPaciente.setPacientes(modelAtendido.consultaPaciente());
			tabelaPaciente.setModel(modeloTabelaPaciente);
		}
	}
	private void selectPesquisaByNome(String nome){
		AtendidoModel modelAtendido = new AtendidoModelImpl();
		PessoaModel model = new PessoaModelImpl();
		modeloTabelaPaciente = new ModeloTabelaPaciente();
		tabelaPaciente.setModel(new DefaultTableModel());
		if(jcAbilitarApoio.isSelected()){
			if(jcAbilitarAFI.isSelected()){
				modeloTabelaPaciente.setPacientes(model.consultaPessoaByNome(nome));
				tabelaPaciente.setModel(modeloTabelaPaciente);
			}else{
				modeloTabelaPaciente.setPacientes(model.consultaPessoaByNomeTipo(nome,EnumTipoTrabalhador.AFI.getTipo()));
				tabelaPaciente.setModel(modeloTabelaPaciente);
			}
		}else if(jcAbilitarAFI.isSelected()){
			modeloTabelaPaciente.setPacientes(model.consultaPessoaByNomeTipo(nome,EnumTipoTrabalhador.APOIO.getTipo()));
			tabelaPaciente.setModel(modeloTabelaPaciente);
		}
		else{
			modeloTabelaPaciente.setPacientes(modelAtendido.consultaPacienteByNome(nome));
			tabelaPaciente.setModel(modeloTabelaPaciente);
		}
	}
	@SuppressWarnings("unused")
	private void rb_filtrarPorDNActionPerformed(java.awt.event.ActionEvent evt) {
		txt_nomePaciente.setVisible(false);
		txt_dnBuscaPaciente.setText("");
		txt_dnBuscaPaciente.setVisible(true);
	}

	@SuppressWarnings("unused")
	private void rb_filtrarPorNomeActionPerformed(java.awt.event.ActionEvent evt) {
		txt_dnBuscaPaciente.setVisible(false);
		txt_nomePaciente.setVisible(true);
		txt_nomePaciente.setText("");
	}

	private void btn_cancelarPacienteActionPerformed(java.awt.event.ActionEvent evt) {
		setVisible(false);
	}

	private javax.swing.ButtonGroup bg_filtrarPorPaciente;
	private javax.swing.JButton btn_alterarPaciente;
	private javax.swing.JButton btn_cancelarPaciente;
	private javax.swing.JButton btn_excluirPaciente;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JLayeredPane painelCamadasFiltrarPor;
	private javax.swing.JPanel painelFiltrarPor;
	private javax.swing.JPanel painelFiltroPaciente;
	private javax.swing.JPanel painelListarPaciente;
	private javax.swing.JPanel painelResultadosPaciente;
	@SuppressWarnings("unused")
	private javax.swing.JRadioButton rb_filtrarPorDN;
	private javax.swing.JRadioButton rb_filtrarPorNome;
	private javax.swing.JTable tabelaPaciente;
	private javax.swing.JFormattedTextField txt_dnBuscaPaciente;
	private javax.swing.JTextField txt_nomePaciente;
	private javax.swing.JCheckBox jcAbilitarAFI;
	private javax.swing.JCheckBox jcAbilitarApoio;

	@Override
	public void keyPressed(KeyEvent e) {
		
	}

	@Override
	public void keyReleased(KeyEvent e) {
		if(e.getSource() == txt_nomePaciente){
			selectPesquisaByNome(txt_nomePaciente.getText());
		}
	}

	@Override
	public void keyTyped(KeyEvent e) {
	}
}

